In data communications on a system consisting of a host computer and a portable electronic apparatus such as an IC card having a storage means composed of a non-volatile memory such as EEPROM, in order to assure a security of communication data, transaction data are transmitted after enciphered at a data originating end and received at a data receiving end after deciphered. In this data communication system, the enciphering and the deciphering of the transaction data are carried out through a procedure using transaction key data while performing a data transaction, such as transmission data between a host computer and an IC card. At this time, prior to the data transaction, the transaction key data to be used for the enciphering data transaction is itself enciphered and transmitted from the host computer to the IC card where it is deciphered and stored in the storage means. Enciphered data received from the host computer is deciphered using the transaction key data stored in the storage means. Thus, the data communication is achieved between the host computer and the IC card.
As described above, in the conventional data communication system to a portable electronic apparatus, for instance, when performing the data transaction on a system consisting of a host computer and IC card, transaction key data to be used for data enciphering/deciphering are stored in a non-volatile memory of an IC card. There was therefore a problem in that transaction key data which was required only for on-line communication of the communication system, was left in the IC card while in the off-line state. This makes it possible to investigate the transaction key data from the IC card during an off-line communication, causing a problem of reducing securities in the on-line system.